package com.scn.base.page;
import java.util.*;
public class TreeNode {
	private String id;
	private String pid;
	private String name;
	private String ename;
	private String link;
	private String img;
	private String srpid;
	private String func;
	private Integer view;
	private Integer order;
	private TreeNode parent=null; /*父节点对象*/
	private Vector<TreeNode> allChild;    /*保存了全部子节点*/
	 
	public String getSrpid() {
		return srpid;
	}

	public void setSrpid(String srpid) {
		this.srpid = srpid;
	}

	public String getFunc() {
		return func;
	}

	public void setFunc(String func) {
		this.func = func;
	}

	public Vector<TreeNode> getAllChild() {
		return allChild;
	}

	public void setAllChild(Vector<TreeNode> allChild) {
		this.allChild = allChild;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getPid() {
		return pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEname() {
		return ename;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public TreeNode getParent() {
		return parent;
	}

	public void setParent(TreeNode parent) {
		this.parent = parent;
	}

	/**
	 *构造
	 */
	 public TreeNode()
	 {
	  allChild=new Vector<TreeNode>();
	 }
	 
	 /**
	 *加子节点
	 */
	 public void addChild(TreeNode child)
	 {
	  allChild.add(child);
	 }

	 /**
	 * 根据ID递归查找子节点，返回节点对象
	 */
	 public TreeNode findChild(String id)
	 {
	  if(id.equals(this.id)) return this;
	  for( Enumeration<TreeNode> e = allChild.elements();e.hasMoreElements();)
	  {
		  TreeNode temp = (TreeNode)e.nextElement();
		  if( id.equals(this.id) ) return temp;
		  TreeNode tmp = temp.findChild(id);
		  if( tmp!=null )return tmp;
	  }
	  return null;
	 }
	 
	 public boolean hasChild(){
		 if(allChild==null||allChild.size()==0){
			 return false;
		 }else{
			 return true;
		 }
	 }

	public Integer getView() {
		return view;
	}

	public void setView(Integer view) {
		this.view = view;
	}

	public Integer getOrder() {
		return order;
	}

	public void setOrder(Integer order) {
		this.order = order;
	}

	
}
